/******************************************************************************
*
* This file is part of FreeTrack (http://code.google.com/p/qtfreetrack).
* BY Willy Gardiol (willy@gardiol.org)
*
* FreeTrack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FreeTrack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar.  If not, see <http://www.gnu.org/licenses/>
*
******************************************************************************/
#ifndef LAYERMANAGER_H
#define LAYERMANAGER_H

#include "IncFreeTrack.h"
#include "freetrackwidget.h"

class FTPushButton;
class Layer;
class LayerTrack;
class FTWidgetList;

class LayerManager : public FreeTrackWidget
{
    Q_OBJECT
public:
    explicit LayerManager(QWidget *parent);

    Layer* getLayer(int);
    LayerTrack* getLivetrack();
    int countLayers();

private:
    // Keep a list of all the loaded layers
    QList<Layer*> layers;
    //
    QHash<int, Layer*> bindings;
    LayerTrack* LiveTrack;

    // Load the layers into a widget scroll area, so it will scroll...
    FTWidgetList* scroll_area;

    // Buttons to load maps/tracks
    FTPushButton* buttonLoadMap;
    FTPushButton* buttonLoadTrack;

    // Add a new layer
    int addLayer( Layer* layer );

    QLayout* createHorizontal();
    QLayout* createVertical();

private slots:
    void loadMap();
    void loadTrack();
    void reoderLayers(QList<int>);
    void deleteLayer(int);

public slots:
    void prepareToQuit();

};
#endif // LAYERMANAGER_H
